/*    */ package com.zimbra.cs.account.ldap.upgrade;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Cos;
/*    */ import com.zimbra.cs.account.Domain;
/*    */ import com.zimbra.cs.account.Entry.EntryType;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import com.zimbra.cs.ldap.LdapClient;
/*    */ import com.zimbra.cs.ldap.LdapServerType;
/*    */ import com.zimbra.cs.ldap.LdapUsage;
/*    */ import com.zimbra.cs.ldap.ZLdapContext;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BUG_87674
/*    */   extends UpgradeOp
/*    */ {
/*    */   private static final String ATTR_NAME = "zimbraPrefSkin";
/*    */   private static final String FROM_VALUE = "serenity";
/*    */   private static final String TO_VALUE = "harmony";
/*    */   
/*    */   void doUpgrade()
/*    */     throws ServiceException
/*    */   {
/* 41 */     ZLdapContext zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.UPGRADE);
/*    */     try {
/* 43 */       doDomains(zlc);
/* 44 */       doCos(zlc);
/*    */     } finally {
/* 46 */       LdapClient.closeContext(zlc);
/*    */     }
/*    */   }
/*    */   
/*    */   Description getDescription()
/*    */   {
/* 52 */     return new Description(this, new String[] { "zimbraPrefSkin" }, new Entry.EntryType[] { Entry.EntryType.DOMAIN, Entry.EntryType.COS }, "serenity", "harmony", "Update skin to 8.5 default for all COS/Domains where it is set to the previous default");
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   private void doDomains(ZLdapContext zlc)
/*    */     throws ServiceException
/*    */   {
/* 61 */     List<Domain> domains = this.prov.getAllDomains();
/* 62 */     if (domains != null) {
/* 63 */       for (Domain domain : domains) {
/* 64 */         String skin = domain.getAttr("zimbraPrefSkin", "");
/* 65 */         if ("serenity".equalsIgnoreCase(skin)) {
/* 66 */           Map<String, Object> attrs = new HashMap();
/* 67 */           attrs.put("zimbraPrefSkin", "harmony");
/* 68 */           modifyAttrs(domain, attrs);
/*    */         }
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   private void doCos(ZLdapContext zlc) throws ServiceException {
/* 75 */     List<Cos> classes = this.prov.getAllCos();
/* 76 */     if (classes != null) {
/* 77 */       for (Cos cos : classes) {
/* 78 */         String skin = cos.getAttr("zimbraPrefSkin", "");
/* 79 */         if ("serenity".equalsIgnoreCase(skin)) {
/* 80 */           Map<String, Object> attrs = new HashMap();
/* 81 */           attrs.put("zimbraPrefSkin", "harmony");
/* 82 */           modifyAttrs(cos, attrs);
/*    */         }
/*    */       }
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/ldap/upgrade/BUG_87674.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */